<!-- 员工详情弹窗 -->
<template>
  <a-form
    ref="form3"
    class="ele-form-detail"
    :model="staffModalApp.staff"
    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
    <a-descriptions :title="staffModalApp.title" bordered>
<!--      <a-descriptions-item label="标识">-->
<!--        {{ staffModalApp.staff.Eid }}-->
<!--      </a-descriptions-item>-->
      <a-descriptions-item label="创建人">
        {{ staffModalApp.staff.creatorName }}
      </a-descriptions-item>
      <a-descriptions-item label="名称">
        {{ staffModalApp.staff.name }}
      </a-descriptions-item>
      <a-descriptions-item label="联系电话">
        {{ staffModalApp.staff.contactTel }}
      </a-descriptions-item>
      <a-descriptions-item label="电子邮箱">
        {{ staffModalApp.staff.email }}
      </a-descriptions-item>
<!--      <a-descriptions-item label="状态">-->
<!--        {{ staffModalApp.staff.status }}-->
<!--      </a-descriptions-item>-->
      <a-descriptions-item label="职务">
        {{ staffModalApp.staff.post }}
      </a-descriptions-item>
<!--      <a-descriptions-item label="创建人ID">-->
<!--        {{ staffModalApp.staff.creatorId }}-->
<!--      </a-descriptions-item>-->
      <a-descriptions-item label="备注">
        {{ staffModalApp.staff.remark }}
      </a-descriptions-item>
      <a-descriptions-item label="创建时间">
        {{ staffModalApp.staff.createDatetime }}
      </a-descriptions-item>
    </a-descriptions>
  </a-form>
</template>

<script>
import {defineComponent, reactive, onMounted, inject} from "vue";
import {useRoute} from "vue-router"
import {StaffService} from "@/views/restaurant/staff/staff/staffService";

export default defineComponent({
  setup() {
    const route = useRoute();
    let routeId = route.params.id;
    let staffListApp = inject('staffListApp', reactive({}));
    const staffModalApp = reactive({id: null, staff: {}, display: false});

    onMounted(() => {
      staffModalApp.staff = {};
      if (routeId) {
        staffModalApp.id = routeId;
      } else if (staffListApp.viewModalShowing) {
        staffModalApp.id = staffListApp.currentId;
        staffModalApp.display = true;
      }
      if (staffModalApp.id) {
        getInfo(staffModalApp.id);
      }
    })

    const getInfo = (id) => {
      StaffService.findStaff(id).then((res) => {
        staffModalApp.staff = res.data;
        // staffModalApp.title = "查看 " + staffModalApp.staff.name;
      })
    }

    return {
      staffModalApp,
      routeId,
      getInfo,
    }
  }
})
</script>

<style scoped>
</style>

